{extend name="layout" /}
{block name="content"}
<div class="row">
  <div class="col-xs-3">
    <form id="searchForm">
      <div class="input-group input-group-sm demoTable">
        <input type="text" class="form-control input-sm" name="keywords" id="demoReload" autocomplete="off" placeholder="请输入姓名或手机号">
        <span class="input-group-btn">
          <button type="button" class="btn btn-info btn-flat layui-btn" data-type="reload">搜  索</button>
        </span>
      </div>
      <input type="hidden" name="dealer" value="1">
    </form>
  </div>
  <div class="col-xs-9" style="text-align: right">
    {eq name="uinfo.roleid" value="4"}
    <button type="button" class="btn btn-success btn-sm cocoModal" isForm url="{:url('add_dealer')}" title="新增项目" fixat="1"><i class="fa fa-plus"></i> 新增</button>
    {/eq}
    <button type="button" class="btn btn-info btn-sm export" title="经销商表"><i class="fa fa-edit"></i> 数据导出</button>
  </div>
</div>
<table class="layui-table" lay-data="{height: 'full-75', cellMinWidth: 80, page: true, id: 'lists',limit:30, url:'{:url('data_show_where', ['dealer'=>1])}'}" lay-filter="lists"> <!-- whereData格式（roleid=6&userid=9） -->
  <thead>
    <tr>      
      <th lay-data="{type:'checkbox'}">ID</th>
      <th lay-data="{field:'userid', sort: true, fixed: 'right', width:80, align:'center'}">UID</th>
      <th lay-data="{field:'fullname'}">全称</th>
      <th lay-data="{field:'realname'}">简称</th>
      <th lay-data="{field:'username'}">用户名</th>
      <th lay-data="{field:'phone'}">手机号</th>
      <!-- <th lay-data="{field:'email'}">邮箱</th> -->
      <!-- <th lay-data="{field:'jifen'}">积分数量</th> -->
      <th lay-data="{field:'province'}">省份</th>
      <th lay-data="{field:'city'}">城市</th>
      <th lay-data="{field:'rolename'}">用户类型</th>
      <!-- <th lay-data="{field:'lastloginip'}">登录IP</th> -->
      <th lay-data="{field:'lastlogintime'}">登录时间</th>
      <th lay-data="{field:'addtime'}">注册时间</th>
      <th lay-data="{field:'statusname'}">状态</th>
      <th lay-data="{field:'sys_manage', fixed: 'right', width:80, align:'center', toolbar: '#barDemo'}">操作</th>
    </tr>
  </thead>
</table>
<script type="text/html" id="barDemo">
  <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
</script>
{/block}
{block name="script"}
<script type="text/javascript">
  layui.use('table', function(){
    var table = layui.table;
    var $ = layui.$, active = {
      reload: function(){
        var demoReload = $('#demoReload');
        //执行重载
        table.reload('lists', {
          page: {
            curr: 1 //重新从第 1 页开始
          }
          ,where: $('#searchForm').serializeObject()
        });
      }
    };
    $('.demoTable .layui-btn').on('click', function(){
      var type = $(this).data('type');
      active[type] ? active[type].call(this) : '';
    });
  });
</script>
{/block}